﻿using System;
using COM.DTO;
using NHibernate;
using COM.Logging;
using NHibernate.Criterion;

namespace DAL.DAO
{
    public class HotelOwnerDAO
    {
        public static void Add(HotelOwner hotelOwner)
        {
            {
                using (ISession session = NHibernateHelper.OpenSession())
                using (ITransaction transaction = session.BeginTransaction())
                {
                    session.SaveOrUpdate(hotelOwner);
                    transaction.Commit();
                }
            }
        }
        public static void Update(HotelOwner hotelOwner)
        {
            {
                using (ISession session = NHibernateHelper.OpenSession())
                using (ITransaction transaction = session.BeginTransaction())
                {
                    session.Update(hotelOwner);
                    transaction.Commit();
                }
            }
        }

        public static void Remove(HotelOwner hotelOwner)
        {
            {
                using (ISession session = NHibernateHelper.OpenSession())
                using (ITransaction transaction = session.BeginTransaction())
                {
                    session.Delete(hotelOwner);
                    transaction.Commit();
                }
            }
        }

        public static HotelOwner GetHotelOwnerByHotelOwnerId(String hotelOwnerId)
        {
            using (ISession session = NHibernateHelper.OpenSession())
                return session.Get<HotelOwner>(hotelOwnerId);
        }


    }
}
